package com.projeto.persistence;

import java.io.Serializable;
import java.math.BigDecimal;

import javax.persistence.*;

/**
 * The persistent class for the receipt_detail database table.
 *
 */
@Entity
@Table(name = "receipt_detail")
public class ReceiptDetail implements Serializable {

    private static final long serialVersionUID = 1L;
    @Id
    private String id;
    private int quantity;
    private String type;
    @Column(name = "VOL_HEIGHT")
    private float volHeight;
    @Column(name = "VOL_LENGHT")
    private float volLenght;
    @Column(name = "VOL_WIDTH")
    private float volWidth;
    private float weight;
    private BigDecimal total;
    //bi-directional many-to-one association to Receipt
    @ManyToOne
    private Receipt receipt;

    public ReceiptDetail() {
    }

    public String getId() {
        return this.id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public int getQuantity() {
        return this.quantity;
    }

    public void setQuantity(int quantity) {
        this.quantity = quantity;
    }

    public String getType() {
        return this.type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public float getVolHeight() {
        return this.volHeight;
    }

    public void setVolHeight(float volHeight) {
        this.volHeight = volHeight;
    }

    public float getVolLenght() {
        return this.volLenght;
    }

    public void setVolLenght(float volLenght) {
        this.volLenght = volLenght;
    }

    public float getVolWidth() {
        return this.volWidth;
    }

    public void setVolWidth(float volWidth) {
        this.volWidth = volWidth;
    }

    public float getWeight() {
        return this.weight;
    }

    public void setWeight(float weight) {
        this.weight = weight;
    }

    public Receipt getReceipt() {
        return this.receipt;
    }

    public void setReceipt(Receipt receipt) {
        this.receipt = receipt;
    }

    public BigDecimal getTotal() {
        return total;
    }

    public void setTotal(BigDecimal total) {
        this.total = total;
    }

    @Override
    public int hashCode() {
        int hash = 3;
        hash = 29 * hash + (this.id != null ? this.id.hashCode() : 0);
        hash = 29 * hash + this.quantity;
        hash = 29 * hash + (this.type != null ? this.type.hashCode() : 0);
        hash = 29 * hash + Float.floatToIntBits(this.volHeight);
        hash = 29 * hash + Float.floatToIntBits(this.volLenght);
        hash = 29 * hash + Float.floatToIntBits(this.volWidth);
        hash = 29 * hash + Float.floatToIntBits(this.weight);
        hash = 29 * hash + (this.total != null ? this.total.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        final ReceiptDetail other = (ReceiptDetail) obj;
        if ((this.id == null) ? (other.id != null) : !this.id.equals(other.id)) {
            return false;
        }
        if (this.quantity != other.quantity) {
            return false;
        }
        if ((this.type == null) ? (other.type != null) : !this.type.equals(other.type)) {
            return false;
        }
        if (Float.floatToIntBits(this.volHeight) != Float.floatToIntBits(other.volHeight)) {
            return false;
        }
        if (Float.floatToIntBits(this.volLenght) != Float.floatToIntBits(other.volLenght)) {
            return false;
        }
        if (Float.floatToIntBits(this.volWidth) != Float.floatToIntBits(other.volWidth)) {
            return false;
        }
        if (Float.floatToIntBits(this.weight) != Float.floatToIntBits(other.weight)) {
            return false;
        }
        if (this.total != other.total && (this.total == null || !this.total.equals(other.total))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "ReceiptDetail{" + "id=" + id + ", quantity=" + quantity + ", type=" + type + ", volHeight=" + volHeight + ", volLenght=" + volLenght + ", volWidth=" + volWidth + ", weight=" + weight + ", total=" + total + ", receipt=" + (receipt != null ? receipt.getId() : "") + '}';
    }
    
    
}